package cn.edu.seu.ssny.entity;

import cn.edu.seu.ssny.entity.support.BaseEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.util.Date;

/**
 * 自控策略图 每一个子项目只有一张
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Entity
@Table(name = "tb_self_controller_image")
public class SelfControllerImage extends BaseEntity {
    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    private Integer id;

    /**
     * 策略图对应项目
     */
    @Column(name = "project_id", nullable = false)
    private Integer projectId;

    /**
     * 策略图路径
     */
    @Column(name = "image_path", nullable = false, columnDefinition = "char(100) not null")
    private String imagePath;

    /**
     * 是否被删除，逻辑删除
     * <p>
     * 数据库中使用tinyint存储，默认是0 未删除
     */
    @Column(name = "isdeleted", columnDefinition = "tinyint(1) default 0")
    private Boolean deleted;

    /**
     * 创建时间
     */
    @Column(name = "gmt_create")
    @CreatedDate //创建时自动添加
    private Date gmtCreate;

    /**
     * 最后一次修改时间
     */
    @Column(name = "gmt_modified")
    @LastModifiedDate //记录最后一次修改时间
    private Date gmtModified;

}
